﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/SiteContent.Master" AutoEventWireup="true"
    CodeBehind="BillHistory.aspx.cs" Inherits="Warehouse.Web.Purchase.BillHistory" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .datatable {
            width: 100%;
        }
        .col-sn {
            width: 40px;
        }
        .col-date {
            width: 80px;
        }
        .col-summary {
        }
        .col-shouldpay {
            width: 80px;
        }
        .col-realpay {
            width: 80px;
        }
        .col-overage {
            width: 80px;
        }
        td.col-shouldpay, td.col-realpay, td.col-overage {
            text-align: right;
        }
    </style>

    <script type="text/javascript">
        function search() {
            window.location.href = "BillHistory.aspx?search=1&SupplierID=" + $('#<%=this.ddlSupplier.ClientID %>').val() + "&Start=" + $('#<%= this.tbStartDate.ClientID %>').val() + "&End=" + $('#<%= this.tbEndDate.ClientID %>').val();
        }

        $(function() {
            $(".datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
        });

        function showBill(Id, type) {
            if (type > 0) {
                var title = ["", "进货单", "赠品单", "退货单"][type];
                top.showWindow("/Purchase/BillView.aspx?ID=" + Id, { title: title, width: 700, height: 500 }, null);
            } else {
                var title = ["", '进货付款单', '退货收款单'][0 - type];
                top.showWindow("/Purchase/PaymentView.aspx?ID=" + Id, { title: title, width: 700, height: 500 }, null);
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="moduleheader">
        <h4>
            往来对账</h4>
        <div class="moduleheadertoolbar">
            <label>
                供货商：<asp:DropDownList ID="ddlSupplier" runat="server" DataTextField="Name" DataValueField="ID">
                </asp:DropDownList>
            </label>
            <label>
                日期：
                <asp:TextBox ID="tbStartDate" runat="server" CssClass="datepicker"></asp:TextBox>
            </label>
            <label>
                —
                <asp:TextBox ID="tbEndDate" runat="server" CssClass="datepicker"></asp:TextBox>
            </label>
            <input type="button" class="ui-button-query" onclick="search();return false;" value="查询" />
        </div>
    </div>
    <div class="modulecontent">
        <asp:Repeater ID="rptData" runat="server">
            <HeaderTemplate>
                <table class="datatable">
                    <thead>
                        <tr>
                            <th class="col-sn">
                                序号
                            </th>
                            <th class="col-date">
                                日期
                            </th>
                            <th class="col-summary">
                                摘要
                            </th>
                            <th class="col-shouldpay">
                                应付
                            </th>
                            <th class="col-realpay">
                                实付
                            </th>
                            <th class="col-overage">
                                应付余额
                            </th>
                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td class="col-sn">
                        <%# Container.ItemIndex %>
                    </td>
                    <td class="col-date">
                        <%# Eval("DateStr") %>
                    </td>
                    <td class="col-summary">
                        <a href="#" onclick="showBill('<%# Eval("BillID") %>',<%# Eval("Type") %>);return false;">
                            <%# Eval("Summary")%></a>
                    </td>
                    <td class="col-shouldpay">
                        <%# Eval("ShouldPayStr")%>
                    </td>
                    <td class="col-realpay">
                        <%# Eval("RealPayStr")%>
                    </td>
                    <td class="col-overage">
                        <%# Eval("Overage","{0:#,##0.00}")%>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </tbody></table></FooterTemplate>
        </asp:Repeater>
    </div>
</asp:Content>
